/*
 * @Description: 地图匹配定位的node文件
 * @Author: Zhijian Qiao
 * @Date: 2020-02-05 02:56:27
 */
#include <ros/ros.h>
#include "glog/logging.h"
#include "tools/file_manager.hpp"
#include "global_defination/global_defination.h"
#include "matching/matching_flow.hpp"
#include "config.h"


using namespace avp_slam;

int main(int argc, char *argv[]) {
    google::InitGoogleLogging(argv[0]);
    FLAGS_log_dir = WORK_SPACE_PATH + "/Log";
    FLAGS_alsologtostderr = true;
    FLAGS_colorlogtostderr = true;
    FLAGS_log_prefix = true;
    FLAGS_logbufsecs = 0;
    FileManager::CreateDirectory(FLAGS_log_dir);

    LOG(INFO) << "matching_node start";
    ros::init(argc, argv, "matching_node");
    ros::NodeHandle nh("~");

    Config::readConfig();

    std::shared_ptr<MatchingFlow> matching_flow_ptr = std::make_shared<MatchingFlow>(nh);

    ros::Rate rate(100);
    while (ros::ok()) {
        ros::spinOnce();

        matching_flow_ptr->Run();

        rate.sleep();
    }

    return 0;
}